//
//  MNDPulsInvestSuccessViewController.m
//  minidai
//
//  Created by Vitas on 2018/7/14.
//  Copyright © 2018年 迷你贷. All rights reserved.
//

#import "MNDPulsInvestSuccessViewController.h"
#import "MNDInvestmentRecordViewController.h"
#import "MNDPlusRecordContainerViewController.h"

@interface MNDPulsInvestSuccessViewController ()
//预期收益
@property (weak, nonatomic) IBOutlet UILabel *proEarnMoneyLabel;
//投资金额
@property (weak, nonatomic) IBOutlet UILabel *investMoneyLabel;
@property (weak, nonatomic) IBOutlet UIButton *shareBtn;


@end

@implementation MNDPulsInvestSuccessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
    [self initBackButtonItem];
    // Do any additional setup after loading the view.
}

- (void)initBackButtonItem {
    
    //创建UIBarButtonSystemItemFixedSpace
    UIBarButtonItem * spaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
                                                                                target:nil action:nil];
    //将宽度设为负值
    spaceItem.width = kScreenWidth < 414? -10 : -15;
    
    UIImage *itemImage = [UIImage imageNamed:@"navi_back_btn_black"];
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithImage: itemImage
                                                             style: UIBarButtonItemStylePlain
                                                            target: self
                                                            action: @selector(backAction:)];
    
    
    [item setTintColor:kColorBlack];
    if (@available(iOS 11.0, *)) {
        self.navigationItem.leftBarButtonItem = item;
    } else {
        self.navigationItem.leftBarButtonItems = @[spaceItem, item];
    }
    for (UIBarButtonItem *item in self.navigationItem.leftBarButtonItems) {
        [item setTintColor:[UIColor blackColor]];
    }
    
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor blackColor]}];
}

- (void)backAction:(id)sender{
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark -搭建界面
- (void)setupUI {
    self.shareBtn.layer.cornerRadius = 5.0;
    self.shareBtn.clipsToBounds  = YES;
    self.shareBtn.layer.borderWidth = 1;
    self.shareBtn.layer.borderColor = [UIColor orangeColor].CGColor;
    self.investMoneyLabel.text = [NSString stringWithFormat:@"￥%@", self.investMoneyStr];
    self.proEarnMoneyLabel.text = [NSString stringWithFormat:@"￥%@", self.proEarnMoneyStr];
}

//继续投资
- (IBAction)clickcontinueBtn:(UIButton *)sender {
    [self.navigationController popToRootViewControllerAnimated:YES];
    //    self.tabBarController.selectedIndex = 1;
    
}

//查看投资详情
- (IBAction)clickShareBtn:(UIButton *)sender {
    
    MNDPlusRecordContainerViewController *investDetailVC = [UIStoryboard viewControllerWithIdentifier:@"MNDPlusRecordContainerViewController"];
    investDetailVC.shouldCustomBack = YES;
    investDetailVC.sign_id = self.sign_id;
    investDetailVC.plusTitle = self.plusTitle;
    [self.navigationController pushViewController:investDetailVC animated:NO];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
